<template>
	<view class="warp">
		<!-- <view class="list">
			<view @click="toinfo(item)" class="item" v-for="(item,index) in projectlist" :key="index">
				<view class="i_left">
					<image style="width: 320rpx;height: 200rpx;" :src="item.websiteImage" mode="aspectFill"></image>
				</view>
				<view class="i_right">
					<view class="i_title">
						{{item.websiteTitle}}
					</view>
					<view class="i_context" v-html="item.websiteContent">
						
					</view>
					<view class="xiang">
					详情
					</view>
				</view>
			</view>
		</view> -->
		<view class="zhao_text">
				<jyfParser :html="projectlist.investmentText" :isAll="true"></jyfParser>
		</view>
		<!-- 联系我们 -->
		<view class="title">
			<view class="t_tetx">
				联系我们
			</view>
		</view>
		<view class="contus">
			
			<view class="contus_left">
				<view class="xiename xiehuilianxi">
					<uni-icons color="#ff841f" type="person" size="30"></uni-icons>
					<view class="text">
						{{projectlist.investmentName}}
					</view>
				</view>
				<view class="xiephone xiehuilianxi">
					<uni-icons color="#ff841f" type="phone" size="30"></uni-icons>
					<view style="color: #5555ff;" @click="tocall(projectlist.investmentPhone)" class="text">
							{{projectlist.investmentPhone}}
					</view>
				</view>
				<view class="xieemail xiehuilianxi">
					<uni-icons color="#ff841f" type="email" size="30"></uni-icons>
					<view class="text">
							{{projectlist.investmentEmail}}
					</view>
				</view>
				<view class="xiemap xiehuilianxi">
					<uni-icons color="#ff841f" type="paperplane" size="30"></uni-icons>
					<view class="text">
							{{projectlist.investmentAddress}}
					</view>
				</view>
			</view>
			<view class="contus_right">
				<image  style="width: 200rpx; height: 200rpx;":src="projectlist.investmentCode" mode=""></image>
			</view>
		</view>
		<!-- 联系我们 -->
		<view class="title">
			<view class="t_tetx">
			留言
			</view>
		</view>
		<view class="giv_message">
			<view class="m_item">
				<view class="label">
					姓名：
				</view>
				<view class="cont">
					<input v-model="form.messageName" style="background-color: #cecece;border-radius: 6rpx;width: 560rpx;height: 50rpx;" type="text"   />
				</view>
			</view>
			<view class="m_item">
				<view class="label">
					电话：
				</view>
				<view class="cont">
					<input v-model="form.messagePhone"  style="background-color: #cecece;border-radius: 6rpx;width: 560rpx;height: 50rpx;" type="text"   />
				</view>
			</view>
			<view class="m_item">
				<view class="label">
					邮箱：
				</view>
				<view class="cont">
					<input v-model="form.messageEmail"  style="background-color: #cecece;border-radius: 6rpx;width: 560rpx;height: 50rpx;" type="text"   />
				</view>
			</view>
			<view class="m_item">
				<view class="label">
					公司：
				</view>
				<view class="cont">
					<input v-model="form.messageCommpany" style="background-color: #cecece;border-radius: 6rpx;width: 560rpx;height: 50rpx;" type="text"   />
				</view>
			</view>
			<view class="m_item">
				<view class="label">
					职务：
				</view>
				<view class="cont">
					<input v-model="form.messageWork" style="background-color: #cecece;border-radius: 6rpx;width: 560rpx;height: 50rpx;" type="text"   />
				</view>
			</view>
			<view class="m_item">
				<view class="label">
					留言：
				</view>
				<view class="cont">
					<textarea v-model="form.messageContext" style="background-color: #cecece;border-radius: 10rpx;" name="" id="" cols="30" rows="30"></textarea>
				</view>
			</view>
			<view class="giv_button ">
				<view @click="givmessagefn" class="button_giv">
					提交
				</view>
				
			</view>
		</view>
	</view>
</template>

<script>
	import { mapState, mapMutations } from 'vuex'
	import jyfParser from '@/components/jyf-parser/jyf-parser'
	 
		
	export default {
		data() {
			return {
				projectlist:{},
				queryform:{
					pageSize:20,
					current:1,
					websiteType:'16',//类型
				},
				total:0,
				type:null,
				form:{
					messageName:null,
					messagePhone:null,
					messageEmail:null,
					messageCommpany:null,
					messageWork:null,
					messageContext:null,
					vendorId:null
					
					
				},
				memberId:null,
				storeId:null,
				shopId:null,
				
			};
		},
		components:{
				jyfParser,
		},
		computed: {
		  ...mapState(['hasLogin', 'userInfo', 'userCenterData'])
		},
		onLoad(options) {
			// if(e){
			// 	this.type=options.type
			// }
			this.memberId=this.$Route.query.memberId
			this.storeId=this.$Route.query.storeId
			this.shopId=this.$Route.query.shopId
			// 商户id
			if(this.storeId){
						uni.setStorageSync('storeId', this.storeId);
					}
					// 店铺
			if(this.shopId){
						uni.setStorageSync('shopId', this.shopId);
					}
			// 保存推荐人id
			if(this.memberId){
				uni.setStorageSync('referrerId', this.memberId);
			}
			this.getlist()
		},
		onShareAppMessage:function(){
			// console.log(this.userCenterData.memberId,'11');
			let pathinfo=''
			let limag=this.projectlist.investmentCode
			if(uni.getStorageSync('storeId')){
				 pathinfo=`/webcont/attracinv/attracinv?memberId=${this.userCenterData.memberId}&storeId=${uni.getStorageSync('storeId')}&shopId=${this.userCenterData.storeId}`
			}else{
			    pathinfo=`/webcont/attracinv/attracinv?memberId=${this.userCenterData.memberId}&storeId=${this.userCenterData.vendorId}&shopId=${this.userCenterData.storeId}`
			}
			// let pathinfo='/extra/activityList/activityList'
			return{
				title: this.webinfo.storeName,
				path:pathinfo,
				imageUrl: limag,
			}
			
		},
		onShareTimeline: function() {
			let pathinfo=''
			let limag=this.projectlist.investmentCode
			if(uni.getStorageSync('storeId')){
				 pathinfo=`/webcont/attracinv/attracinv?memberId=${this.userCenterData.memberId}&storeId=${uni.getStorageSync('storeId')}&shopId=${this.userCenterData.storeId}`
			}else{
				 pathinfo=`/webcont/attracinv/attracinv?memberId=${this.userCenterData.memberId}&storeId=${this.userCenterData.vendorId}&shopId=${this.userCenterData.storeId}`
			}
			// let pathinfo='/extra/activityList/activityList'
			return{
				title: this.webinfo.storeName,
				path:pathinfo,
				imageUrl: limag,
			}
		},
		// 下拉
			onPullDownRefresh() {
				// 刷新位置
			this.getlist()
				var that=this
				setTimeout(function(){
						uni.stopPullDownRefresh()
					},1000)
			},
			onReachBottom(){
				if(this.queryform.pageSize*this.queryform.current>this.total){
					uni.showToast({
						title:"数据加载完毕",
						icon:'none'
					})
				}else{
					this.queryform.current++
					this.$request({
						url:'v3/pc/front/memberInvestment/list',
						method:'GET',
						data:this.queryform
					}).then(res=>{
						this.projectlist=res.data
						
					})
				}
			},
		methods:{
			
			getlist(){
						this.queryform.vendorId=uni.getStorageSync('storeId') 
				// if(this.type==1){
				// 					 // 查看自己
				// 					 this.queryform.vendorId=this.userCenterData.vendorId
				// }else{
				// 					 // 查看浏览协会
				// 					this.queryform.vendorId=uni.getStorageSync('storeId') 
				// }
				// this.queryform.vendorId=uni.getStorageSync('storeId')
				this.$request({
					url:'v3/pc/front/memberInvestment/list',
					method:'GET',
					data:this.queryform
					 
				}).then(res=>{
					if(res.state==200){
						this.projectlist=res.data
						// this.total=res.data.pagination.total
					}
				})
				// if(uni.getStorageSync('storeId')){
					
				// }else{
				// 	this.queryform.vendorId='480019'
				// 	this.$request({
				// 		url:'v3/website/front/seller/list',
				// 		method:'GET',
				// 		data:this.queryform
				// 	}).then(res=>{
				// 		if(res.state==200){
				// 			this.projectlist=res.data.list
				// 		}
				// 	})
				// }
				
			},
			// 提交留言
			givmessagefn(){
				 if(this.form.messageName && this.form.messagePhone && this.form.messageEmail && this.form.messageContext){
					 
				
				this.form.vendorId=uni.getStorageSync('storeId') 
				this.$request({
					url:'v3/pc/front/memberInvestmentMessage/add',
					method:"POST",
					header:{
						'Content-Type': 'application/json'
					},
					data:this.form
				}).then(res=>{
					if(res.state==200){
						uni.showToast({
							title:"您的留言已提交，我们会尽快回复！",
							icon:"none"
						}),
						this.form={
							messageName:null,
							messagePhone:null,
							messageEmail:null,
							messageCommpany:null,
							messageWork:null,
							messageContext:null,
							vendorId:null
						}
					}
				})
				 }else{
					 uni.showToast({
					 	title:'请完善信息，方便我们联系您',
						icon:"none"
					 })
				 }
			},
			// 拨号
			tocall(val){
				uni.makePhoneCall({
					phoneNumber: val //仅为示例
				});
			},
		
			// 详情
			toinfo(val){
				uni.navigateTo({
					url:"/webcont/ximageinfo/ximageinfo?id="+val.websiteId
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
page{
			width: 750rpx;
			margin: 0 auto;
			background: #F5F5F5;
			
		}
		.warp{
			 .zhao_text{
				 padding: 10rpx;
				 background-color: #ffff;
			 }
			 .title{
				 margin-top: 20rpx;
				 // font-size: 32rpx;
				text-align: center;
				background-color: #fff;
				padding: 20rpx;
				.t_tetx{
					display: inline-block;
					font-size: 30rpx;
					font-weight: 550;
					padding-bottom: 10rpx;
					border-bottom: 6px solid #ff841f;
				}
			 }
		 .contus{
			 display: flex;
			 justify-content: space-between;
			 align-items: center;
			 background-color: #fff;
			 padding: 10rpx;
			 .contus_left{
				 .xiehuilianxi{
					 display: flex;
					 align-items: center;
					 font-size: 28rpx;
					 .text{
						 margin-left: 10rpx;
					 }
				 }
			 }
			 .contus_right{
				 width: 200rpx;
				 border: 2rpx solid #cecece;
				 margin-left: 10rpx;
			 }
		 }
		 .giv_message{
			 background-color: #fff;
			 padding: 20rpx;
			 .m_item{
				 display: flex;
				 margin-bottom: 20rpx;
			 }
			 .giv_button{
				 text-align: center;
				 .button_giv{
					 display: inline-block;
					 padding: 20rpx 50rpx;
					 background-color: #ff841f;
					 color: #fff;
					 border-radius: 10rpx;
				 }
			 }
		 }
		}
</style>
